<HTML>
	<TITLE>Workflow.NET
		<%#actionname%>
		-<%#propertyname%></TITLE>
	<STYLE><%#stylesheet%>
	</STYLE>
		<form name="wf_theform" method="post" ID="Form1">
			<TABLE width="100%" height="100%" bgcolor="white" cellspacing="0" cellpadding="0" border="0"
				ID="Table1">
				<TR>
					<TD valign="top">
						<TABLE width="100%" height="100%" ID="Table2">
							<TR>
								<TD valign="top">
									<IFRAME name="frame_preview" src="<%#requeststring%>&amp;pagesection=previewframe&amp;_mode=<%#mode%>" width="100%" height="100%">
									</IFRAME>
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="black"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="white"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD align="center" height="50">
						<TABLE border="0" width="80%">
							<TR>
								<TD colspan="2">
									<B>To add new variables please provide the following information and click on
										the Add button below</B>
								</TD>
							</TR>
							<TR>
								<TD>
									No. of variables
								</TD>
								<TD>
									<input type="textbox" class="inputs" name="txtaddinputs" value="1" style="WIDTH:40px">
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="black">
						<IMG src="?drawimage=spacer.gif" height="1" width="1">
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="white">
						<IMG src="?drawimage=spacer.gif" height="1" width="1">
					</TD>
				</TR>
				<TR>
					<TD align="right" height="30">
						<input type="button" class="buttons" value=" Add "      name="btnaddnew" onclick="addnew(document.wf_theform.txtaddinputs.value )">
						<input type="button" class="buttons" value=" Modify " 	  name="btnmodify" onclick="modify('page1')">
						<input type="button" class="buttons" value="Remove"   name="btnremove" onclick="remove()">
						<input type="button" class="buttons" value="Close" ID="btnCancel" onclick="window.close();" NAME="btnCancel">
					</TD>
				</TR>
			</TABLE>
			<input type="hidden" name="_hidtempstore" id="_hidtempstore">
			<input type="hidden" name="_mode" ID="_mode">
			<input type="hidden" name="_pageinfo" id="_pageinfo">
		</form>
		<SCRIPT>
		function modify(pageinfo)
			{
				var returnvalue=getselectedvalues();
				if (returnvalue.length>0)
				{
					document.wf_theform._mode.value='modify';
					document.wf_theform._pageinfo.value = pageinfo;
					document.wf_theform._hidtempstore.value=returnvalue;
					document.wf_theform.submit()
				}
				else
				{
					alert("Please check the boxes against the variables you wish to Modify.");
				}

			}
			function addnew(tempstore)
			{

				if (isNaN(document.wf_theform.txtaddinputs.value)|| parseInt(document.wf_theform.txtaddinputs.value)==0)
					{
						alert("Incorrect entry. No. of Variables for updation should be a numeric value and greater than 0");
						document.wf_theform.txtaddinputs.focus();
						return ;
					}
					document.wf_theform._mode.value='addnew';
					document.wf_theform._pageinfo.value = 'page1';
					document.wf_theform._hidtempstore.value=tempstore;
					document.wf_theform.submit()
			}
			function remove()
			{
				var returnvalue=getselectedvalues();
				if (returnvalue.length>0)
				{
					document.wf_theform._mode.value='remove';
					document.wf_theform._hidtempstore.value=returnvalue;
					document.wf_theform.submit()
				}
				else
				{
					alert("Please check the boxes against the variables you wish to Delete.");
				}
			}
			function getselectedvalues()
			{
				var returnvalue="";
				var i=0;
				var obj = eval("frame_preview");
				var tempobj;
				var d = obj.document
	//alert('d.wf_theform.variablefieldscount.value ' +	d.wf_theform.variablefieldscount.value );
				if (parseInt(d.wf_theform.variablefieldscount.value)> 0 )
				{
					tempobj = eval("d.wf_theform.VariableFieldName")
					for ( i = 0 ;i<parseInt(d.wf_theform.variablefieldscount.value);i++)
					{
						if (parseInt(d.wf_theform.variablefieldscount.value) ==1)
						{
							if (tempobj.checked)
								returnvalue += "," + tempobj.value;
						}
						else if (tempobj[i].checked)
						{
						//alert('tempobj[i].value' + tempobj[i].value);
							returnvalue += "," + tempobj[i].value
						}
					}
				}
				if (returnvalue.length > 0)
					returnvalue = returnvalue.substring(1,returnvalue.length)
					//alert('return value is  ' + returnvalue);
				return 	returnvalue;
			}
		</SCRIPT>
	</BODY>
</HTML>
